<template>
  <div class="list-right" v-if="viewModel">
    <div class="list-right_h3">帐号管理</div>
    <!-- <div class="list-right_grid">
      <div class="grid-text">全部</div>
      <div class="grid-text">最新</div>
    </div> -->
    <ul class="list-right_box" v-if="viewModel.length!=0">
      <li class="right_box-li" v-for="(item,index) in viewModel" :key="index">
        <div class="li-text" @click="$router.push('/admin/tutorial/show?id='+item.id)">{{item.title}}</div>
        <div class="li-intro">
          <div class="li-intro_time">{{item.createTime}}</div>
          <div class="li-intro_look"><i class="el-icon-view"></i>{{item.stepCount}}</div>
        </div>
      </li>
    </ul>
    <zk-nodata v-else></zk-nodata>
    <div class="list-right_pages">
      <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page.sync="pagesArray.currentPage1" :page-size="pagesArray.size" layout="total, prev, pager, next" :total="pagesArray.count">
      </el-pagination>
    </div>
  </div>
</template>
<script>
  import ala from 'ala'
  export default {
    data () {
      return {
        viewModel: null,
        gridList: null,
        pagesArray: {
          currentPage1: 0,
          size: 81,
          count: 0
        }
      }
    },
    mounted () {
      this.init()
    },
    methods: {
      async init (val) {
        var para = {
          classId: ''
        }
        if (val) {
          para.classId = val
        } else if (this.$route.query.classId) {
          para.classId = this.$route.query.classId
        }
        var repones = await ala.diyHttpGet('Api/Tutorial/QueryList', para)
        this.viewModel = repones
        this.pagesArray.count = this.viewModel.length
        this.pagesArray.currentPage1 = Math.ceil(this.pagesArray.count / this.pagesArray.size)
      },
      handleSizeChange (val) {

      },
      handleCurrentChange (val) { }
    }
  }
</script>
<style lang="scss">
  @import "./widget.scss";
</style>